package search.areas;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import search.service.AreasDaoManager;
import search.service.impl.factory.ManagerFactory;

public class SearchHandlerServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static AreasDaoManager adm = null;

    public SearchHandlerServlet() {
    	adm = ManagerFactory.getInstance();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-16");
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setContentType("text/html;charSet=UTF-16");
		
		String content = request.getParameter("content");
		System.out.println(content+".......");
		String areas = adm.toJsonArray(content);
		response.getWriter().append(areas);
	}
}
